package burubaka.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2012-05-04 21:41:09")
/** */
public final class SystemInfoMeta extends org.slim3.datastore.ModelMeta<burubaka.model.SystemInfo> {

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.SystemInfo, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.SystemInfo, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.UnindexedAttributeMeta<burubaka.model.SystemInfo, com.google.appengine.api.datastore.Text> mypageInfoArea1 = new org.slim3.datastore.UnindexedAttributeMeta<burubaka.model.SystemInfo, com.google.appengine.api.datastore.Text>(this, "mypageInfoArea1", "mypageInfoArea1", com.google.appengine.api.datastore.Text.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.SystemInfo> mypageInfoLine1 = new org.slim3.datastore.StringAttributeMeta<burubaka.model.SystemInfo>(this, "mypageInfoLine1", "mypageInfoLine1");

    /** */
    public final org.slim3.datastore.UnindexedAttributeMeta<burubaka.model.SystemInfo, com.google.appengine.api.datastore.Text> topInfoArea1 = new org.slim3.datastore.UnindexedAttributeMeta<burubaka.model.SystemInfo, com.google.appengine.api.datastore.Text>(this, "topInfoArea1", "topInfoArea1", com.google.appengine.api.datastore.Text.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<burubaka.model.SystemInfo> topInfoLine1 = new org.slim3.datastore.StringAttributeMeta<burubaka.model.SystemInfo>(this, "topInfoLine1", "topInfoLine1");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.SystemInfo, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.SystemInfo, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final SystemInfoMeta slim3_singleton = new SystemInfoMeta();

    /**
     * @return the singleton
     */
    public static SystemInfoMeta get() {
       return slim3_singleton;
    }

    /** */
    public SystemInfoMeta() {
        super("SystemInfo", burubaka.model.SystemInfo.class);
    }

    @Override
    public burubaka.model.SystemInfo entityToModel(com.google.appengine.api.datastore.Entity entity) {
        burubaka.model.SystemInfo model = new burubaka.model.SystemInfo();
        model.setKey(entity.getKey());
        model.setMypageInfoArea1((com.google.appengine.api.datastore.Text) entity.getProperty("mypageInfoArea1"));
        model.setMypageInfoLine1((java.lang.String) entity.getProperty("mypageInfoLine1"));
        model.setTopInfoArea1((com.google.appengine.api.datastore.Text) entity.getProperty("topInfoArea1"));
        model.setTopInfoLine1((java.lang.String) entity.getProperty("topInfoLine1"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        burubaka.model.SystemInfo m = (burubaka.model.SystemInfo) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setUnindexedProperty("mypageInfoArea1", m.getMypageInfoArea1());
        entity.setProperty("mypageInfoLine1", m.getMypageInfoLine1());
        entity.setUnindexedProperty("topInfoArea1", m.getTopInfoArea1());
        entity.setProperty("topInfoLine1", m.getTopInfoLine1());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        burubaka.model.SystemInfo m = (burubaka.model.SystemInfo) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        burubaka.model.SystemInfo m = (burubaka.model.SystemInfo) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        burubaka.model.SystemInfo m = (burubaka.model.SystemInfo) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        burubaka.model.SystemInfo m = (burubaka.model.SystemInfo) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        burubaka.model.SystemInfo m = (burubaka.model.SystemInfo) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getMypageInfoArea1() != null && m.getMypageInfoArea1().getValue() != null){
            writer.setNextPropertyName("mypageInfoArea1");
            encoder0.encode(writer, m.getMypageInfoArea1());
        }
        if(m.getMypageInfoLine1() != null){
            writer.setNextPropertyName("mypageInfoLine1");
            encoder0.encode(writer, m.getMypageInfoLine1());
        }
        if(m.getTopInfoArea1() != null && m.getTopInfoArea1().getValue() != null){
            writer.setNextPropertyName("topInfoArea1");
            encoder0.encode(writer, m.getTopInfoArea1());
        }
        if(m.getTopInfoLine1() != null){
            writer.setNextPropertyName("topInfoLine1");
            encoder0.encode(writer, m.getTopInfoLine1());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    protected burubaka.model.SystemInfo jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        burubaka.model.SystemInfo m = new burubaka.model.SystemInfo();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("mypageInfoArea1");
        m.setMypageInfoArea1(decoder0.decode(reader, m.getMypageInfoArea1()));
        reader = rootReader.newObjectReader("mypageInfoLine1");
        m.setMypageInfoLine1(decoder0.decode(reader, m.getMypageInfoLine1()));
        reader = rootReader.newObjectReader("topInfoArea1");
        m.setTopInfoArea1(decoder0.decode(reader, m.getTopInfoArea1()));
        reader = rootReader.newObjectReader("topInfoLine1");
        m.setTopInfoLine1(decoder0.decode(reader, m.getTopInfoLine1()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        return m;
    }
}